package com.bzyd.verify.limiter;

import com.bzyd.verify.common.SysResult;
import com.bzyd.verify.utils.RequestUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LimitController {

    @RequestMapping("/testRate")
    public SysResult test1() throws Exception{
        RequestUtil.rateLimit("test1",60,"请求过于频繁！");
        return SysResult.ok();
    }

    @RequestMapping("/testCount")
    public SysResult test2() throws Exception{
        RequestUtil.countLimit("test2",1,10,"达到最大请求次数！");
        return SysResult.ok();
    }
}
